package io.gitee.cisumer.amazing.master;

import io.gitee.cisumer.amazing.Pixel;

/**
 *
 * @author gitee.com/cisumer
 * @date create in 2022/3/17
 */
public class AllColor implements Pixel {
	@Override
	public int r(int i, int j) {
		return (int) square(( Math.cos(Math.atan2(j-512,i-512)/2))*255);
	}
	
	@Override
	public int g(int i, int j) {
		return (int) square(( Math.cos(Math.atan2(j-512,i-512)/2-2*Math.acos(-1)/3))*255);
	}
	
	@Override
	public int b(int i, int j) {
		return (int) square(( Math.cos(Math.atan2(j-512,i-512)/2+2*Math.acos(-1)/3))*255);
	}
	
	private Number square(Number x){
		return (int) (x.doubleValue()*x.doubleValue());
	}
	
	@Override
	public String name() {
		return "色谱";
	}
}
